package starComponent.experiments.expedependencies;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Toolkit;

import javax.swing.JDialog;
import javax.swing.JPanel;


/**
 * @author Charles Perin
 * 9 juin 2011
 * LIMSI - INRIA Rennes
 * charles.perin@free.fr
 */
public class ExperimentDialog extends JDialog{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -5175478475615386986L;
	private String message;
	
	public ExperimentDialog(Frame parent, String title, String message){
		super(parent, title, true);
		this.message = message;
		
		setLocation((int)Toolkit.getDefaultToolkit().getScreenSize().getWidth()/2-300, (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight()/2-200);
		setResizable(false);
		initComponent();
		pack();
		
		this.setVisible(true);
		
		this.setSize(new Dimension(600,400));
		
	}
	

	private void initComponent() {
		this.getContentPane().setLayout(new BorderLayout());
		
		
		OrientedLabel labelLeft = new OrientedLabel(message, OrientedLabel.LEFT_ORIENTED);
		OrientedLabel labelRight = new OrientedLabel(message, OrientedLabel.RIGHT_ORIENTED);
		
		labelLeft.setPreferredSize(new Dimension(200,350));
		labelRight.setPreferredSize(new Dimension(200,350));

		JPanel content = new JPanel(new GridBagLayout());
		content.setPreferredSize(new Dimension(600,400));
		GridBagConstraints c = new GridBagConstraints();
		c.insets=new Insets(10, 10, 10, 10);
		c.gridx=0;
		c.gridy=0;
		c.fill=GridBagConstraints.BOTH;


		content.add(labelLeft,c);
		
		c.gridx+=1;
		
		content.add(labelRight,c);

		

		this.getContentPane().add(content, BorderLayout.CENTER);
	}

}
